<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head th:replace="_fragment_front :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索</title>
    <link rel="stylesheet" href="../static/css/me.css">
    <link rel="stylesheet" href="../static/lib/semantic/semantic.min.css">
</head>
<body class="body tagBody">

    <!--导航-->
    <nav th:replace="_fragment_front :: nav(0)" class="gird-header">
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <a href="#"><h2 class="ui olive header item">风铃</h2></a>
                <a href="#" class="m-item item m-mobile-hide"><i class="home icon"></i>首页</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="graduation cap icon"></i>资源库</a>
                <a href="#" class="m-item item m-mobile-hide"><i class="clone icon"></i>归档</a>
                <div class="m-item item right m-mobile-hide">
                    <form action="#" name="search" method="post" target="_blank">
                        <div class="ui icon inverted transparent input m-margin-tb-tiny">
                            <input type="text" name="query" placeholder="Search....">
                            <i class="search link icon"></i>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </nav>

    <!--顶部图片-->
    <div class="m-bg-type_outer m-top">
        <img th:src="@{/images/resourcebg.jpg}" alt="分类背景图" class="ui m-bg image m-top-image">
        <div class="m-bg-class_cover">
            <div class="ui container m-top-image-text">
                <div class="m-font-size-title m-right-bottom m-center">文章搜索</div>
                <div class="m-font-size-text-init-title m-margin-top m-center" th:text="#{search-sentence}"></div>
            </div>
        </div>
    </div>

    <!--中间内容-->
    <div id="waypoint" class="m-margin- animated fadeIn">
        <div class="ui container">

            <!--标签类型-->
            <div class="ui segment m-padded-tb-large m-opacity">
                <div class="ui container m-center">
                    <div class="m-center m-font-size-text-black">
                        包含关键字"<span class="m-teal" th:text="${query}">Java</span>"的文章
                    </div>
                </div>
            </div>

            <!--标签下的博客-->
            <div class="ui padded segment m-padded-tb-large m-opacity" th:each="blog : ${blogs.getList()}">
                <div class="ui large aligned mobile reversed stackable grid">
                    <div class="eleven wide column">
                        <h3 class="ui header"><a th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black m-title-font" th:text="${blog.title}">大圣，此去欲何</a></h3>
                        <p class="m-text" th:text="${blog.description}">戴上金箍，没法爱你；放下金箍，没法保护你。我知道上天不会给我第二次机会，曾经我们说好的永远，原来也仅仅只有，十二画，而已。“大圣，此去欲何?”“踏南天，碎凌霄。”“若一去不回……”“便一去不回” 其实很多时候，我们都是有机会的，最后真正放弃的，是我们自己。......</p>
                        <div class="ui grid">
                            <div class="eleven wide column">
                                <div class="ui mini horizontal link list">
                                    <div class="item">
                                        <img th:src="@{/images/avatar.jpg}" alt="" class="ui avatar image">
                                        <div class="content"><a th:href="@{/archives}" target="_blank" class="header" th:text="#{AdminName}">WindChime</a></div>
                                    </div>
                                    <div class="item">
                                        <i class="calendar icon m-icon"></i> <span class="m-icon-text" th:text="${#dates.format(blog.createTime, 'yyyy-MM-dd HH:mm:ss')}">2021-07-23</span>
                                    </div>
                                    <div class="item">
                                        <i class="eye icon m-icon"></i> <span class="m-icon-text" th:text="${blog.views}">1314</span>
                                    </div>
                                    <div class="item">
                                        <i class="comment outline icon m-icon"></i> <span class="m-icon-text" th:text="${blog.commentCount}">2021</span>
                                    </div>
                                </div>
                            </div>
                            <div class="right aligned five wide column">
                                <a th:href="'/types?id=' + ${blog.typeId}" target="_blank" class="ui teal basic label m-padded-tiny m-text-thin" th:text="${blog.typeName}">好文</a>
                            </div>
                        </div>
                    </div>
                    <div class="five wide column">
                        <a th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                            <img th:src="${blog.cover}" alt="" class="ui rounded image">
                        </a>
                    </div>
                </div>
            </div>

            <!--分页-->
            <div class="ui bottom attached segment m-opacity stackable grid">
                <div class="three wide column" align="center">
                    <a class="item" th:href="'/search' + '?query=' + ${query} + '&page=' + (${blogs.hasPreviousPage} ? ${blogs.prePage} : 1)" th:unless="${blogs.isFirstPage}">上一页</a>
                </div>
                <div class="ten wide column" align="center">
                    <p> <span th:text="${blogs.pageNum}"></span> / <span th:text="${blogs.pages}"></span> </p>
                </div>
                <div class="three wide column" align="center">
                    <a class="item" th:href="'/search' + '?query=' + ${query} + '&page=' + (${blogs.hasNextPage} ? ${blogs.nextPage} : ${blogs.pages})" th:unless="${blogs.isLastPage}">下一页</a>
                </div>
            </div>

        </div>
    </div>

    <!--置顶图标-->
    <div id="toolbar" class="m-padded-tb-large m-fixed m-right-bottom" style="display: none">
        <a href="#" class="ui teal icon button"><i class="chevron up icon"></i></a>
    </div>

    <br>
    <br>

    <!--底部栏-->
    <footer th:replace="_fragment_front :: footer" class="ui inverted vertical segment m-padded-tb-massive m-opacity">
    <!--容器-->
    <div class="ui center aligned container">
        <div class="ui inverted divided stackable grid">
            <div class="four wide column">
                <div class="ui inverted m-text-thin m-text-spaced m-margin-top-max m-footer-title">联系我</div>
                <div class="ui inverted link list">
                    <div class="m-text-thin">Email：2540487435@qq.com</div>
                    <div class="m-text-thin">QQ：2540487435</div>
                </div>
            </div>

            <div class="four wide column" >
                <div class="ui inverted link list">
                    <div class="item">
                        <!--微信二维码-->
                        <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加微信</div>
                        <img src="../static/images/wechat.png" class="ui m-margin-top rounded image m-QR" alt="">
                    </div>
                </div>
            </div>

            <div class="four wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <!--qq群二维码-->
                        <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加QQ</div>
                        <img src="../static/images/QQ.jpeg" class="ui m-margin-top rounded image m-QR" alt="">
                    </div>
                </div>
            </div>
            <!--博客运行时间统计-->
            <div class="four wide column">
                <div style="font-size: large;font-weight: bold" class="ui inverted m-text-thin m-text-spaced m-margin-top">博客总览</div>
                <div id="blog-message">
                    <div class="ui inverted link list m-padded-tiny m-margin-top">
                        <div class="m-text-thin m-footer-position">
                            文章总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 篇
                        </div>
                        <div class="m-text-thin m-footer-position">
                            访问总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 次
                        </div>
                        <div class="m-text-thin m-footer-position">
                            评论总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 条
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ui inverted section divider"></div>
        <div class="ui inverted m-text-thin m-text-spaced m-footer-time">此网站已运行：<span id="timer" class="item m-text-thin"></span></div>
    </div>
</footer>

    <!--/*/<th:block th:replace="_fragment_front :: script">/*/-->
    <script src="../static/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../static/lib/semantic/semantic.min.js"></script>
    <script src="../static/lib/waypoints/jquery.waypoints.min.js"></script>
    <!--人物的看板娘-->
    <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>

    <script>
    /*此处为网站的创建时间*/
    function setTime() {
        var create_time = Math.round(new Date(Date.UTC(2021, 6, 23, 0, 0, 0)).getTime() / 1000);
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
        currentTime = secondToDate((timestamp - create_time));
        $('#timer').html(currentTime[0] + '年' + currentTime[1] + '天' + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4] + '秒')
    }
    setInterval(setTime, 1000)
    //计算时间
    function secondToDate(second) {
        if (!second) {
            return 0
        }
        var time = new Array(0, 0, 0, 0, 0)
        if (second >= 365 * 24 * 3600) {
            time[0] = parseInt(second / (365 * 24 * 3600))
            second %= 365 * 24 * 3600
        }
        if (second >= 24 * 3600) {
            time[1] = parseInt(second / (24 * 3600))
            second %= 24 * 3600
        }
        if (second >= 3600) {
            time[2] = parseInt(second / 3600)
            second %= 3600
        }
        if (second >= 60) {
            time[3] = parseInt(second / 60)
            second %= 60
        }
        if (second > 0) {
            time[4] = second
        }
        return time;
    }

    //看板娘初始化
    L2Dwidget.init({
        "model": {
            jsonPath: "https://unpkg.com/live2d-widget-model-miku@1.0.5/assets/miku.model.json",
            "scale": 1
        },
        "display": {
            "position": "left",
            "width": 120,
            "height": 170,
            "hOffset": 0,
            "vOffset": 0
        },
        "mobile": {
            "show": true,
            "scale": 0.5
        },
        "react": {
            "opacityDefault": 0.7,
            "opacityOnHover": 0.8
        },
    })

    //回到顶部按钮
    var waypoint = new Waypoint({
        element: $('#waypoint'),
        handler: function(direction) {
            if (direction == 'down') {
                $('#toolbar').show(100)
            } else {
                $('#toolbar').hide(500)
            }
        }
    })

    //手机汉堡菜单
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    })

</script>
    <!--/*/</th:block>/*/-->

</body>
</html>
